<template>
    <div>
        <p>7. 数据封装</p>
        <dl>
            <dt>统一封装数据请求服务，有利于解决：</dt>
            <dd>（1）统一配置请求</dd>
            <dd>（2）请求、响应统一处理</dd>
        </dl>
        <el-button type="primary" @click="getUsers">获取用户</el-button>
    </div>
</template>

<script>
import request from 'utils/request'

export default {
    setup () {
        const getUsers = async () => {
            const users = await request({
                url: '/getUsers',
                method: "get",
            })
            console.log('users', users.data)
        }
        return { getUsers }
    }
}
</script>

<style lang="scss" scoped>
dd {
    margin-left: 0;
}
</style>